<?php

namespace Common\Model;

use Think\Model;

class PriceModel extends Model {
    public static function newSelf()
    {
        return new self();
    }
    public function findOneById($id)
    {
        return $this->where(['id'=>$id])->find();
    }
    public function getPriceList()
    {
        return $this->order('id asc')->select();
    }
    public function findNowPrice()
    {
        return $this->where(['num>0'])->order('id asc')->find();
    }
    public function findNowBuyPrice()
    {
        return $this->where(['num>0 and buy_num < num'])->order('id asc')->find();
    }
    public function findNowSellPrice()
    {
        return $this->where(['num>0 and sell_num < num'])->order('id asc')->find();
    }
    public function findPriceByPrice($price)
    {
        return $this->where(['num>0','price'=>$price])->order('id asc')->find();
    }
}